package com.quan.OGCamera;

import com.example.test1.R;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

public class ImageMergingActivity extends Activity{

	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.image_merging);
	    
	    // Get the fileUri passed with the intent
	    Bundle extras = getIntent().getExtras(); 	    

	    if (extras != null) {
	        Long id = (Long) extras.getLong("imageId");
	        int leftMargin = extras.getInt("leftMargin");
	        int topMargin = extras.getInt("topMargin");
	        String resourceName = "glass"+id;
	        //Merge image with a bullet hole image
	        if (id != 0) {
	        	//Bitmap overlay = BitmapFactory.decodeResource(this.getResources(), R.drawable.glass1);
				Bitmap overlay = ImageManager.drawableToBitmap((ImageManager.getAndroidDrawable(resourceName,this.getBaseContext())));
				Bitmap result = ImageManager.overlayAtPosition(ImageManager.workingImage, overlay, leftMargin, topMargin);
				ImageView imgView = (ImageView) findViewById(R.id.resultImage);
				imgView.setImageBitmap(result);
				ImageManager.workingImage = result;
	        }
	        
	    }
	    
	}
	
	public void shareButtonPressed(View view) {
		Intent intent = new Intent(this, FacebookLoginActivity.class);
		startActivity(intent);
	}
	
}
